import{Component,Input,Output,EventEmitter}from '@angular/core'
@Component({
    selector:'app-voter',
    template:`
        <h4>{{name}}}</h4>
        <button (click)="vote(true)" [disabled]="voted">同意</button>
        <button (click)="vote(false)" [disabled]="voted">不同意</button>
    `
})
export class VoterComponent{
    @Input() name:string;
    @Output() onVoted=new EventEmitter<boolean>();

    voted=false;

    vote(agreed:boolean){
        this.onVoted.emit(agreed);
        this.voted = true;
    }
}